import request from '@/utils/request'
import qs from 'qs'

// 获取系统用户列表
export function fetchList (params) {
  return request({
    url: '/sysUser/list',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(params)
  })
}

// 获取系统用户详情
export function getSysUserDetail (params) {
  const data = {
    id: params
  }
  return request({
    url: '/sysUser/detail',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

// 修改系统用户
export function updateSysUser (params) {
  return request({
    url: '/sysUser/update',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(params)
  })
}

// 修改系统用户
export function updateSysUserStatus (id, status) {
  const data = {
    id: id,
    status: status
  }
  return request({
    url: '/sysUser/update',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

// 批量删除系统用户
export function deleteSysUser (params) {
  return request({
    url: '/sysUser/delete',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    params: params
  })
}
